import { defineStore } from 'pinia'
import request from '@/utils/request.js'

export const useUserStore = defineStore("user", {
  state: () => {
    return {
      user: {} // 用户信息
    };
  },
  actions: {
    async getUserInfo(token) {
      try {
        let params = {token}
        let res = await request.post('/user/profile', params)
        this.user = res.data.data;
        return res.data.data;
      } catch (error) {
        console.error(error);
      }
    }
  }
});
